//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "Platforms/Base/IApplication.h"

#if defined( PLATFORM_ANDROID )


namespace Engine
{
namespace Platforms
{

	//
	// Android OpenGL Library
	//

	struct AndroidLibOpenGL
	{
	// variables
	private:
		Library		_lib;


	// methods
	public:
		AndroidLibOpenGL ()
		{}
		
		bool Load (uni_c_string name = uni_c_string())
		{
			if ( not name.Empty() )
			{
				if ( _lib.Load( name, true ) )
					return true;
			}

			if ( _lib.Load( GetDefaultName(), true ) )
				return true;

			return false;
		}
		
		void Unload ()
		{
			_lib.Unload();
		}

		void * GetProc (uni_c_string address) const
		{
			void * res = null;

			if ( (res = _lib.GetProc( address )) != null )
				return res;

			return null;
		}

		static uni_c_string GetDefaultName ()
		{
			return "libGLESv2.so";
		}
	};


}	// Platforms


namespace Base
{
	typedef Platforms::AndroidLibOpenGL		LibOpenGL;

}	// Base
}	// Engine

#endif	// PLATFORM_ANDROID